package com.ec.edu.common.encoder;

import com.ec.edu.common.util.MessagePackUtil;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class MsgPackEncoder extends MessageToByteEncoder<Object> {
    protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {

        byte[] raw =  MessagePackUtil.toBytes(msg);

        out.writeBytes(raw);

    }
}
